package com.olinsports.system.olinsportssystem.controller;

import com.olinsports.system.olinsportssystem.manager.ActivityManager;
import com.olinsports.system.olinsportssystem.manager.CommodityDetailedManager;
import com.olinsports.system.olinsportssystem.model.Activity;
import com.olinsports.system.olinsportssystem.model.CommodityDetailed;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/22.
 */
@Controller
@RequestMapping("activity")
public class ActivityController {
    @Autowired
    private ActivityManager activityManager;

    @RequestMapping("/selectAll")
    @ResponseBody
    public List<Activity> selectAll() {
        return activityManager.selectAll();
    }

    @RequestMapping("/insertAll")
    @ResponseBody
    public int insertAll(Activity activity) {
        return activityManager.insertAll(activity);
    }

    @RequestMapping("/deleteByKey")
    @ResponseBody
    public int deleteByKey(int actKey) {
        return activityManager.deleteByKey(actKey);
    }
    @RequestMapping("/updateData")
    @ResponseBody
    public int updateData(Activity activity) {
        return activityManager.updateData(activity);
    }

    @RequestMapping("/selectByKey")
    @ResponseBody
    public Activity selectByKey(int actKey) {
        return activityManager.selectByKey(actKey);
    }
    @RequestMapping("/saveOrUpdateActivity")
    @ResponseBody
    public int saveOrUpdateActivity(Activity activity) {
        return activityManager.saveOrUpdateActivity(activity);
    }

    @RequestMapping("/listActivity")
    @ResponseBody
    public Map listActivity(String page, String rows, String sord, String sidx) {
        return activityManager.listActivity(page,rows,sord,sidx);
    }
}
